package com.leboncoin.util;

import java.text.DecimalFormat;
import java.util.logging.Logger;

public class FormatManager {

	static Logger logger = Logger.getLogger(FormatManager.class.getName());	

	public static String formatNumber(Integer number){
		String result = null;
		try{
			DecimalFormat formatter = new DecimalFormat("#,##0.###");
			result = formatter.format(number);
			result = result.replace((char) 160,' '); //Remplace l'espace insecable par un espace normal
		}catch (IllegalArgumentException e){
			logger.severe("Cannot convert "+number+" to string");
		}
		return result;
	}
}
